package org.dromara.easyes.test.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.easyes.annotation.HighLight;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;

/**
 * 功能描述:  <p></p>
 *
 * @version 1.0 2019-10-31
 * @since logan-web 1.0
 */
@Data
@Accessors(chain = true)
@IndexName(value="web_log_detail-#{BY_MONTH}", shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true)
public class WebLogDetailDTO implements Comparable<WebLogDetailDTO> {
    @IndexId(type = IdType.CUSTOMIZE)
    private Long id;

    private Long taskId;

    private int logType;
    @HighLight(mappingField = "highlightContent")
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.KEYWORD)
    private String content;

    private long logTime;

    private int logLevel;

    private int minuteOffset;

    private long addTime = System.currentTimeMillis();

    @Override
    public int compareTo(WebLogDetailDTO o) {
        if (null == o) {
            return 0;
        }
        return (int) (this.logTime - o.getLogTime());
    }
}
